package com.example.logistics_manage.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "config.sms")
public class SmsConfig {
    private String accessKeyId;
    private String accessSecret;
    private String signName;
    private String regionId;

    @Bean
    public IAcsClient getSMSClient(){
        DefaultProfile profile
                = DefaultProfile.getProfile(this.getRegionId(),
                this.getAccessKeyId(),
                this.getAccessSecret());
        IAcsClient client = new DefaultAcsClient(profile);
        return client;
    }
}